/*
 * @Author: chentao
 * @Date: 2022-05-07 14:54:55
 * @Last Modified by: chentao
 * @Last Modified time: 2022-05-07 17:50:28
 */
//函数的常规参数
function funcName(name, age) {
    return name + age;
}
var funNameResult = funcName("string", 3);
console.log(funNameResult);
//可选参数
function funcSelect(name, age) {
    var _a;
    return (_a = name + age) !== null && _a !== void 0 ? _a : 0;
}
var funcSelectResult = funcSelect("selectName", 3);
console.log("funcSeelctResult".concat(funcSelectResult));
//ts的函数数组类型的剩余参数类型
//比如我定义一个函数类型
function funcMoreTotal() {
    var args = [];
    for (var _i = 0; _i < arguments.length; _i++) {
        args[_i] = arguments[_i];
    }
    var total = 0;
    for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {
        var i = args_1[_a];
        total += i;
    }
    return total;
}
var addTotal = funcMoreTotal(1, 2, 3, 4);
console.log("".concat(addTotal));
//ts元组类型的数组剩余参数
function funcMoreMix() {
    var args = [];
    for (var _i = 0; _i < arguments.length; _i++) {
        args[_i] = arguments[_i];
    }
    console.log("\u5224\u65ADargs\u7684\u6570\u636E\u7C7B\u578B".concat(Object.prototype.toString.call(args)));
    console.log("length:".concat(args.length));
    var result = '';
    for (var _a = 0, args_2 = args; _a < args_2.length; _a++) {
        var item = args_2[_a];
        if (typeof item === 'number') {
            result = result.concat(item.toString());
            console.log("\u5217\u8868\u7684itemNumber:".concat(result));
        }
        else if (typeof item === 'string') {
            result = result.concat(item);
            console.log("\u5217\u8868\u7684itemString:".concat(result));
        }
    }
    return result;
}
//等同于这个
function funcMoreMix2(arg0, arg1) {
    return arg0.toString().concat(arg1);
}
var stringNumberTotal = funcMoreMix(123, "string");
console.log("\u5143\u7EC4\u7C7B\u578B1:".concat(stringNumberTotal));
var stringNumberTotal2 = funcMoreMix2(123, "string");
console.log("\u5143\u7EC4\u7C7B\u578B2:".concat(stringNumberTotal2));
function test() {
    console.log("test函数调用");
}
test.version = "aaa";
test.name = "";
console.log(test);
